package com.example.finalwork;

import android.content.Intent;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;

import com.example.finalwork.Day.DayActivity;
import com.example.finalwork.Income.IncomeMainActivity;
import com.example.finalwork.Pay.PayMainActivity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    TextView personal_document,system_Overview,income_management,pay_management,day_management,tuichu;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        personal_document = findViewById(R.id.personal_document);
        system_Overview = findViewById(R.id.system_Overview);
        income_management = findViewById(R.id.income_management);
        pay_management = findViewById(R.id.pay_management);
        day_management = findViewById(R.id.day_management);
        tuichu = findViewById(R.id.tuichu);

        //Toast.makeText(this,data,Toast.LENGTH_SHORT).show();

        Drawable dwpersonal_document = getResources().getDrawable(R.drawable.personal);
        dwpersonal_document.setBounds(0, 0, 100, 100);
        personal_document.setCompoundDrawables(dwpersonal_document, null, null, null);
        personal_document.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
        personal_document.getPaint().setAntiAlias(true);//抗锯齿

        Drawable dwsystem_Overview = getResources().getDrawable(R.drawable.system);
        dwsystem_Overview.setBounds(0, 0, 100, 100);
        system_Overview.setCompoundDrawables(dwsystem_Overview, null, null, null);
        system_Overview.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
        system_Overview.getPaint().setAntiAlias(true);//抗锯齿

        Drawable dwincome_management = getResources().getDrawable(R.drawable.income);
        dwincome_management.setBounds(0, 0, 100, 100);
        income_management.setCompoundDrawables(dwincome_management, null, null, null);
        income_management.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
        income_management.getPaint().setAntiAlias(true);//抗锯齿

        Drawable dwpay_management = getResources().getDrawable(R.drawable.pay);
        dwpay_management.setBounds(0, 0, 100, 100);
        pay_management.setCompoundDrawables(dwpay_management, null, null, null);
        pay_management.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
        pay_management.getPaint().setAntiAlias(true);//抗锯齿

        Drawable dwday_management = getResources().getDrawable(R.drawable.day);
        dwday_management.setBounds(0, 0, 100, 100);
        day_management.setCompoundDrawables(dwday_management, null, null, null);
        day_management.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
        day_management.getPaint().setAntiAlias(true);//抗锯齿


        Drawable dwtuichu = getResources().getDrawable(R.drawable.tuichu);
        dwtuichu.setBounds(0, 0, 100, 100);
        tuichu.setCompoundDrawables(dwtuichu, null, null, null);
        tuichu.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
        tuichu.getPaint().setAntiAlias(true);//抗锯齿


        findViewById(R.id.personal_document).setOnClickListener(this);
        findViewById(R.id.system_Overview).setOnClickListener(this);
        findViewById(R.id.income_management).setOnClickListener(this);
        findViewById(R.id.pay_management).setOnClickListener(this);
        findViewById(R.id.day_management).setOnClickListener(this);
        findViewById(R.id.tuichu).setOnClickListener(this);

        setTitle("个人记账系统");
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.system_Overview:
                Toast.makeText(this,"进入系统概述",Toast.LENGTH_SHORT).show();
                startActivity(new Intent(this,SystemActivity.class));
                break;
            case R.id.personal_document:
                Toast.makeText(this,"进入个人资料",Toast.LENGTH_SHORT).show();
                startActivity(new Intent(this,PersonActivity.class));
                break;
            case R.id.income_management:
                Toast.makeText(this,"进入收入项目管理",Toast.LENGTH_SHORT).show();
                startActivity(new Intent(this,IncomeMainActivity.class));
                break;
            case R.id.pay_management:
                Toast.makeText(this,"进入支出项目管理",Toast.LENGTH_SHORT).show();
                startActivity(new Intent(this, PayMainActivity.class));
                break;
            case R.id.day_management:
                Toast.makeText(this,"进入日账单",Toast.LENGTH_SHORT).show();
                startActivity(new Intent(this, DayActivity.class));
                break;
            case R.id.tuichu:
                Toast.makeText(this,"成功退出系统",Toast.LENGTH_SHORT);
                startActivity(new Intent(this,LoginActivity.class));
                break;
        }
    }
}
